// Object为根类型，后面除了null和undefined等空类型，其他的值都可以存放,{}是他的简写形式
let data: Object = 3
let data2: {} = new Set([1, 2, 3])

let data3: object = { age: 23 }

// 联合类型
let str: string | number = 3
console.log("str:",str);

// 交叉类型
// let obj1:{username:string} = {username:'abc'}
// let obj2:{age:number} = {age:23}

type Obj1 = {username:string}
type Obj2 = {age:number}
let obj1:Obj1 = {username:'abc'}
let obj2:Obj2 = {age:23}

let obj3:Obj1 & Obj2 = {
    username:'abc',
    age:23
}

// 交叉是有条件的
// let str2:string & number = 3

// 字面量数据类型
type num = 1|2|3
// let n:num = 4  //报错
// type A = number | string
// let a:A = 'Abc'
// type num = number
// let n:num = 3

type increaseFlag = 0 | 1
function isStartUp(increase:increaseFlag){
    if(increase){
        console.log('启动');
    }
    else{
        console.log('关闭');
    }
}
// isStartUp(3) //报错
isStartUp(1)
export {}